package com.itrus.spring.transaction.service;


import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronizationManager;

@Service
public class SecondService {

    @Transactional(rollbackFor = Exception.class)
    public void execute() {
        boolean synchronizationActive = TransactionSynchronizationManager.isSynchronizationActive();
        System.out.println("SecondService synchronizationActive:" + synchronizationActive);
        throw new RuntimeException("SecondService error");
    }
}